<template>
  <view class="container">
    <view class="card">
      <text class="title">我的美元资产</text>
      <text class="value">{{ totalUsd }} USD</text>
      <text class="sub">≈ {{ (totalUsd * rate).toFixed(2) }} CNY</text>
    </view>

    <!-- 关于卡片 -->
    <view class="card about-card">
      <text class="about-title">关于</text>
      <text class="version-text">当前版本：v1.0.0</text>
    </view>

    <view class="card " @click="callApi">
      <view class="menu-icon bg-gray">
        <text class="icon-text">🔧</text>
      </view>
      <text class="menu-text">测试接口</text>
    </view>

    <!-- 感谢卡片 -->
    <view class="card thank-you-card">
      <text class="thank-you-text">感谢您的使用</text>
    </view>
  </view>
</template>

<script setup>
import { ref, onMounted } from "vue";

// 这里用 ref 模拟数据，后续可以改成从后端获取
const totalUsd = ref(2000);
const rate = ref(7.3);

onMounted(() => {
  // TODO: 可调用 Flask API 获取实时汇率和资产数据
});
</script>

<style>
.container {
  padding: 20px;
  background-color: #f8f8f8;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.title {
  font-size: 20px;
  color: #666;
}

.value {
  font-size: 36px;
  font-weight: bold;
  margin: 10px 0;
  color: #007AFF;
}

.sub {
  font-size: 18px;
  color: #999;
}

/* 关于卡片样式 */
.about-card {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.about-title {
  font-size: 20px;
  font-weight: bold;
  color: #333;
  margin-bottom: 10px;
}

.version-text {
  font-size: 16px;
  color: #666;
}

/* 感谢卡片样式 */
.thank-you-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 24px 20px;
}

.thank-you-text {
  font-size: 18px;
  font-weight: 500;
}
</style>
